package cn.roadtrip.utilmodule.util.enumpck;

/**
 * 登录方式
 */
public enum Enum_LoginPlat {
    WeiChatMiniProm("WeiChatMiniProm", "微信小程序"),
    WeiChatPub("WeiChatPub", "微信公众号"),
    H5("H5", "H5页面"),
    App("App", "App"),
    Zhifubao("Zhifubao", "支付宝");

    private String s;
    private String title;

    Enum_LoginPlat(String s, String title) {
        this.s = s;
        this.title = title;
    }
    Enum_LoginPlat(String s) {
        this.s = s;
        this.title = Enum_LoginPlat.parseCode(s).getTitle();
    }

    public String getTitle() {
        return this.title;
    }

    public String getCode() {
        return this.s;
    }

    public static final Enum_LoginPlat parseCode(String code) {
        switch (code) {
            case "WeiChatMiniProm":
                return WeiChatMiniProm;
            case "WeiChatPub":
                return WeiChatPub;
            case "H5":
                return H5;
            case "App":
                return App;
            case "Zhifubao":
                return Zhifubao;

        }
        return null;
    }

    @Override
    public String toString() {
        return "(code:%s, title:%s)".formatted(this.s, this.title);
    }
}
